package com.yonyou.cyxdms.basedata.service.controller.sap;

import com.alibaba.fastjson.JSON;
import com.yonyou.cyxdms.basedata.service.dto.sap.SapOptionInDto;
import com.yonyou.cyxdms.basedata.service.dto.sap.SapProductInDto;
import com.yonyou.cyxdms.basedata.service.service.sap.SapProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/sapProduct")
public class SapProductController {

    @Autowired
    SapProductService sapProductService;

    @PostMapping("/product")
    public void getProductInfo(@RequestBody SapProductInDto sapProductInDto){
        sapProductService.getProductInfo(JSON.toJSONString(sapProductInDto));
    }

    @GetMapping("/handle/product")
    public void handleProductInfo(@RequestParam(value = "param") String param){
        sapProductService.handleProductInfo(param);
    }

    @PostMapping("/option")
    public void getOption(@RequestBody SapOptionInDto sapOptionInDto){
        sapProductService.getOptionInfo(JSON.toJSONString(sapOptionInDto));
    }

    @GetMapping("/handle/configPrice")
    public void handleConfigPrice(@RequestParam(value = "param") String param){
        sapProductService.handleConfigPriceInfoJob(param);
    }

}
